Activity Monitor.

Activity Monitor.

Activity Monitor and vial.

Activity Monitor and vial.

Evolved Populations:

Plot:

Model:

hour.mod <- lm(Hourly_activity ~ Predation + Predation:Population + hour + monitor + start_day,data=dat.hourly_2)


summary(hour.mod)
# Accounting for the auto-correlation
gls.mod <- gls(Hourly_activity ~ Predation + Predation:Population + hour + monitor + start_day,
    correlation = corAR1(form =~hour|individual),
    data=dat.hourly_2)



anova(gls.mod)

summary(gls.mod)
gls.mod.2 <- gls(Hourly_activity ~ Predation + Predation:Population + light + light:Predation +  hour + monitor + start_day,
    correlation = corAR1(form =~hour|individual),
    data=dat.hourly_2)  

summary(gls.mod.2)
## Generalized least squares fit by REML
##   Model: Hourly_activity ~ Predation + Predation:Population + light +      light:Predation + hour + monitor + start_day 
##   Data: dat.hourly_2 
##        AIC      BIC    logLik
##   65642.46 65735.65 -32807.23
## 
## Correlation Structure: AR(1)
##  Formula: ~hour | individual 
##  Parameter estimate(s):
##       Phi 
## 0.6782841 
## 
## Coefficients:
##                                 Value Std.Error   t-value p-value
## (Intercept)                 241.34462 23.068553 10.462061  0.0000
## PredationMantids            -49.09869 16.540037 -2.968475  0.0030
## PredationSpider             -54.05986 16.540037 -3.268424  0.0011
## lightlight                   -2.40636  5.614807 -0.428574  0.6682
## hour                          0.46920  0.343496  1.365948  0.1720
## monitor2                    -20.42689  5.399740 -3.782940  0.0002
## start_day                    -4.67585  0.827698 -5.649219  0.0000
## PredationControl:Population  -5.05300  4.182621 -1.208094  0.2271
## PredationMantids:Population  -1.64032  4.182621 -0.392176  0.6949
## PredationSpider:Population    3.00350  4.182621  0.718091  0.4727
## PredationMantids:lightlight  22.49193  7.854511  2.863569  0.0042
## PredationSpider:lightlight   29.77666  7.854511  3.791027  0.0002
## 
##  Correlation: 
##                             (Intr) PrdtnM PrdtnS lghtlg hour   montr2
## PredationMantids            -0.358                                   
## PredationSpider             -0.358  0.500                            
## lightlight                  -0.078  0.141  0.141                     
## hour                        -0.156  0.000  0.000 -0.147              
## monitor2                    -0.117  0.000  0.000  0.000  0.000       
## start_day                   -0.840  0.000  0.000  0.000  0.000  0.000
## PredationControl:Population -0.453  0.632  0.632  0.000  0.000  0.000
## PredationMantids:Population  0.000 -0.632  0.000  0.000  0.000  0.000
## PredationSpider:Population   0.000  0.000 -0.632  0.000  0.000  0.000
## PredationMantids:lightlight  0.072 -0.202 -0.101 -0.699  0.000  0.000
## PredationSpider:lightlight   0.072 -0.101 -0.202 -0.699  0.000  0.000
##                             strt_d PrdC:P PrdM:P PrdS:P PrdtM:
## PredationMantids                                              
## PredationSpider                                               
## lightlight                                                    
## hour                                                          
## monitor2                                                      
## start_day                                                     
## PredationControl:Population  0.000                            
## PredationMantids:Population  0.000  0.000                     
## PredationSpider:Population   0.000  0.000  0.000              
## PredationMantids:lightlight  0.000  0.000  0.000  0.000       
## PredationSpider:lightlight   0.000  0.000  0.000  0.000  0.500
## 
## Standardized residuals:
##        Min         Q1        Med         Q3        Max 
## -1.5228457 -0.7029253 -0.2660428  0.4731306 10.5374245 
## 
## Residual standard error: 97.27581 
## Degrees of freedom: 5760 total; 5748 residual

What are we trying to achieve? We want to fit a model that looks something like this

new.model <- glmer(Hourly_activity ~ Predation + Predation:Population + light + light:Predation +  **f(hour)** + monitor + start_day 
    + (1 + **f(hour)** + light | individual),
    correlation = corAR1(form =~hour|individual)) 
    # Do we still need this for residual variance?).

The question is, what is the functional form of *f()`?

Mantid Cues

man.mod <- lm(activity_counts ~ Treatment + hour + monitor,data=Mantid_hour)



summary(man.mod)
#pacf(resid(man.mod))
man_mod_2 <- gls(activity_counts ~ Treatment + hour + monitor, correlation = corAR1(form = ~ 1|hour), data=Mantid_hour)

anova(man_mod_2)
summary(man_mod_2)
#acf(resid(man_mod_2))
man_mod_3 <- gls(activity_counts ~ Treatment + light + light:Treatment +  hour + monitor, correlation = corAR1(form =~1|hour), control = list(singular.ok = TRUE), data=Mantid_hour)


summary(man_mod_3)
## Generalized least squares fit by REML
##   Model: activity_counts ~ Treatment + light + light:Treatment + hour +      monitor 
##   Data: Mantid_hour 
##        AIC      BIC    logLik
##   7576.585 7614.001 -3780.292
## 
## Correlation Structure: AR(1)
##  Formula: ~1 | hour 
##  Parameter estimate(s):
##         Phi 
## -0.02507329 
## 
## Coefficients:
##                                Value Std.Error   t-value p-value
## (Intercept)                15.377915  2.518158  6.106810  0.0000
## TreatmentMantid             3.022189  2.757262  1.096083  0.2734
## lightlight                 12.207182  3.010944  4.054270  0.0001
## hour                       -0.299871  0.171128 -1.752317  0.0801
## monitor2                   -1.367636  1.932598 -0.707667  0.4794
## TreatmentMantid:lightlight -9.470931  3.823295 -2.477164  0.0135
## 
##  Correlation: 
##                            (Intr) TrtmnM lghtlg hour   montr2
## TreatmentMantid            -0.546                            
## lightlight                 -0.277  0.458                     
## hour                       -0.506  0.000 -0.442              
## monitor2                   -0.376 -0.003  0.005 -0.011       
## TreatmentMantid:lightlight  0.395 -0.721 -0.635  0.000  0.000
## 
## Standardized residuals:
##        Min         Q1        Med         Q3        Max 
## -0.8787072 -0.5620015 -0.3474958  0.2376949 11.2351921 
## 
## Residual standard error: 27.63892 
## Degrees of freedom: 800 total; 794 residual
#confint(man_mod_3)
#acf(resid(man_mod_3))

Spider Cues

Plot:

Model:

hour.mod <- lm(activity_counts ~ Treatment + hour + monitor,data=act_hour)



summary(hour.mod)
#pacf(resid(hour.mod))
correl_mod <- gls(activity_counts ~ Treatment + hour + monitor, correlation = corAR1(form = ~ 1|hour), data=act_hour)

anova(correl_mod)
summary(correl_mod)
#acf(resid(correl_mod))
act_cor_light_mod <- gls(activity_counts ~ Treatment + light + light:Treatment +  hour + monitor, correlation = corAR1(form =~1|hour), control = list(singular.ok = TRUE), data=act_hour)


summary(act_cor_light_mod)
## Generalized least squares fit by REML
##   Model: activity_counts ~ Treatment + light + light:Treatment + hour +      monitor 
##   Data: act_hour 
##        AIC      BIC    logLik
##   8740.556 8777.972 -4362.278
## 
## Correlation Structure: AR(1)
##  Formula: ~1 | hour 
##  Parameter estimate(s):
##      Phi 
## 0.189614 
## 
## Coefficients:
##                                Value Std.Error   t-value p-value
## (Intercept)                 58.46631  6.404279  9.129258  0.0000
## TreatmentSpider            -16.58233  7.075310 -2.343690  0.0193
## lightlight                  17.27978  7.807945  2.213102  0.0272
## hour                        -1.21836  0.447145 -2.724753  0.0066
## monitor2                   -14.73985  4.365534 -3.376414  0.0008
## TreatmentSpider:lightlight  -5.28255  9.816117 -0.538151  0.5906
## 
##  Correlation: 
##                            (Intr) TrtmnS lghtlg hour   montr2
## TreatmentSpider            -0.542                            
## lightlight                 -0.277  0.453                     
## hour                       -0.524  0.000 -0.443              
## monitor2                   -0.324 -0.030 -0.001  0.000       
## TreatmentSpider:lightlight  0.397 -0.720 -0.629  0.000  0.002
## 
## Standardized residuals:
##        Min         Q1        Med         Q3        Max 
## -1.0426789 -0.5293192 -0.2776230  0.1330279  8.8264125 
## 
## Residual standard error: 58.62376 
## Degrees of freedom: 800 total; 794 residual
#confint(act_cor_light_mod)
#acf(resid(act_cor_light_mod))

Complex Cues: Experiment 2 (Crickets vs. Spiders)

Exp2_mod <- lm(activity_counts ~ Treatment + hour + monitor,data=Exp2_hour)



summary(Exp2_mod)
#pacf(resid(Exp2_mod))
Exp2_mod_2 <- gls(activity_counts ~ Treatment + hour + monitor, correlation = corAR1(form = ~ 1|hour), data=Exp2_hour)

anova(Exp2_mod_2)
summary(Exp2_mod_2)
#acf(resid(Exp2_mod_2))
Exp2_mod_3 <- gls(activity_counts ~ Treatment + light + light:Treatment +  hour + monitor, correlation = corAR1(form =~1|hour), control = list(singular.ok = TRUE), data=Exp2_hour)


summary(Exp2_mod_3)
## Generalized least squares fit by REML
##   Model: activity_counts ~ Treatment + light + light:Treatment + hour +      monitor 
##   Data: Exp2_hour 
##        AIC      BIC    logLik
##   9280.294 9318.027 -4632.147
## 
## Correlation Structure: AR(1)
##  Formula: ~1 | hour 
##  Parameter estimate(s):
##       Phi 
## 0.3532345 
## 
## Coefficients:
##                                Value Std.Error   t-value p-value
## (Intercept)                 69.48297  8.797518  7.898020  0.0000
## TreatmentSpider             18.71113  9.541616  1.961003  0.0502
## lightlight                  19.23095 10.557260  1.821585  0.0689
## hour                        -2.55429  0.620627 -4.115655  0.0000
## monitor2                   -20.94594  5.445182 -3.846693  0.0001
## TreatmentSpider:lightlight   7.96490 13.056399  0.610038  0.5420
## 
##  Correlation: 
##                            (Intr) TrtmnS lghtlg hour   montr2
## TreatmentSpider            -0.542                            
## lightlight                 -0.280  0.452                     
## hour                       -0.529  0.000 -0.446              
## monitor2                   -0.319  0.000  0.002 -0.001       
## TreatmentSpider:lightlight  0.396 -0.731 -0.618  0.000  0.000
## 
## Standardized residuals:
##        Min         Q1        Med         Q3        Max 
## -1.2782087 -0.6403775 -0.2858197  0.2660999  4.7367746 
## 
## Residual standard error: 68.9982 
## Degrees of freedom: 832 total; 826 residual
#confint(Exp2_mod_3)
#acf(resid(Exp2_mod_3))

Complex Cues: Experiment 3: Crickets, Flies, Spiders fed crickets and spiders fed flies

exp3.mod <- lm(activity_counts ~ Treatment + hour + monitor,data=Exp3_hour)



summary(exp3.mod)
#pacf(resid(exp3.mod))
exp3.mod_2 <- gls(activity_counts ~ Treatment + hour + monitor, correlation = corAR1(form = ~ 1|hour), data=Exp3_hour)

anova(exp3.mod_2)
summary(exp3.mod_2)
#acf(resid(exp3.mod_2))
exp3.mod_3 <- gls(activity_counts ~ Treatment + light + light:Treatment +  hour + monitor, correlation = corAR1(form =~1|hour), control = list(singular.ok = TRUE), data=Exp3_hour)


summary(exp3.mod_3)
## Generalized least squares fit by REML
##   Model: activity_counts ~ Treatment + light + light:Treatment + hour +      monitor 
##   Data: Exp3_hour 
##        AIC      BIC    logLik
##   17824.65 17888.64 -8900.325
## 
## Correlation Structure: AR(1)
##  Formula: ~1 | hour 
##  Parameter estimate(s):
##       Phi 
## 0.3474537 
## 
## Coefficients:
##                            Value Std.Error   t-value p-value
## (Intercept)            114.69176 11.256779 10.188684  0.0000
## TreatmentF             -39.68239 12.971874 -3.059110  0.0023
## TreatmentSC            -24.71865 13.170769 -1.876781  0.0607
## TreatmentSF            -24.24473 13.392779 -1.810283  0.0704
## lightlight             -13.79016 14.300861 -0.964289  0.3351
## hour                    -2.99360  0.576370 -5.193894  0.0000
## monitor2                 6.77289  4.997551  1.355243  0.1755
## TreatmentF:lightlight   22.52772 17.521953  1.285685  0.1987
## TreatmentSC:lightlight  28.50192 17.749811  1.605759  0.1085
## TreatmentSF:lightlight  41.87207 18.042923  2.320692  0.0204
## 
##  Correlation: 
##                        (Intr) TrtmnF TrtmSC TrtmSF lghtlg hour   montr2
## TreatmentF             -0.663                                          
## TreatmentSC            -0.690  0.588                                   
## TreatmentSF            -0.680  0.560  0.599                            
## lightlight             -0.519  0.524  0.542  0.534                     
## hour                   -0.384  0.000  0.000  0.000 -0.303              
## monitor2               -0.214 -0.013  0.011  0.012  0.002  0.000       
## TreatmentF:lightlight   0.492 -0.740 -0.435 -0.415 -0.708  0.001  0.001
## TreatmentSC:lightlight  0.511 -0.436 -0.742 -0.444 -0.730  0.001 -0.004
## TreatmentSF:lightlight  0.504 -0.416 -0.444 -0.742 -0.720  0.000 -0.002
##                        TrtmF: TrtSC:
## TreatmentF                          
## TreatmentSC                         
## TreatmentSF                         
## lightlight                          
## hour                                
## monitor2                            
## TreatmentF:lightlight               
## TreatmentSC:lightlight  0.588       
## TreatmentSF:lightlight  0.562  0.597
## 
## Standardized residuals:
##        Min         Q1        Med         Q3        Max 
## -1.4204762 -0.6420698 -0.3261980  0.2820635  5.0138722 
## 
## Residual standard error: 85.50982 
## Degrees of freedom: 1539 total; 1529 residual
#confint(exp3.mod_3)
#acf(resid(exp3.mod_3))